package com.yanchangapp.ui.activity.base;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.zxl.baselib.ui.base.BaseActivity;
import com.zxl.baselib.ui.base.BasePresenter;
import com.yanchangapp.R;
import com.yanchangapp.widget.X5WebView;

import butterknife.BindView;

public class AccreditActivity extends BaseActivity {
    @BindView(R.id.ivToolbarNavigation)
    ImageView ivToolbarNavigation;
    @BindView(R.id.vToolbarDivision)
    View vToolbarDivision;
    @BindView(R.id.tvToolbarTitle)
    TextView tvToolbarTitle;
    @BindView(R.id.x5WebView)
    X5WebView x5WebView;
    private boolean isFirstIn = true;
    @Override
    protected void init() {

    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_accredit;
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        tvToolbarTitle.setText("\"大桥用户\"注册协议");
        x5WebView.getSettings();
        // 三条///
        x5WebView.setHorizontalScrollBarEnabled(false);
        x5WebView.setVerticalScrollBarEnabled(false);
        x5WebView.loadUrl("file:///android_asset/h5/protocol.html");
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (isFirstIn){
            isFirstIn = false;
        }else {
            x5WebView.onResume();
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        x5WebView.onPause();
        x5WebView.getSettings().setLightTouchEnabled(false);
    }

    @Override
    protected void onDestroy() {
        if (x5WebView != null){
            x5WebView.destroy();
        }
        super.onDestroy();
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {
        ivToolbarNavigation.setOnClickListener(v -> finish());
    }

}
